<%@ page import="edu.njfu.javawebdemo.dao.UserDao" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: guzhe
  Date: 2020/12/11
  Time: 9:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    //防止request中文乱码
request.setCharacterEncoding("UTF-8");
%>
<html>
<head>
    <title>request Demo</title>
</head>
<body>
<form action="requestDemo.jsp" method="get">
    请输入姓名：<input type="text" name="name"/>
    <input type="submit" value="确定" name="submit">
</form>
<%
String submit=request.getParameter("submit");
//首次打开本页面submit为null
    //判断submit是否为null，不为null，表示提交，null表示没有提交
    if(submit!=null && submit.equals("确定")){
        response.getWriter().write(request.getParameter("name"));
        request.setAttribute("hello","hello world!");
        request.getRequestDispatcher("shows.jsp").forward(request,response);
    }

%>
</body>
</html>
